package de.kardass.jannobatch.examples.simple;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import de.kardass.jannobatch.ItemReader;
import de.kardass.jannobatch.examples.simple.data.SimpleInputItem;

public class SimpleDataReader implements ItemReader<SimpleInputItem> {
	
	private final List<SimpleInputItem> list;

	public SimpleDataReader() {
		super();
		this.list = new ArrayList<SimpleInputItem>();
		list.add(new SimpleInputItem(1, "eins"));
		list.add(new SimpleInputItem(2, "zwei"));
		list.add(new SimpleInputItem(3, "drei"));
	}

	@Override
	public void onShutDown() {
		System.out.println("..." + getClass() + "-> finish");
	}

	@Override
	public void onStartUp() {
		System.out.println("..." + getClass() + "-> init");
	}

	@Override
	public Iterator<SimpleInputItem> iterator() {
		System.out.println("..." + getClass() + "-> iterator...");
		return list.iterator();
	}

}
